SPB Git

Repository Public

page.tsx 3.6 KB 83 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Vrai-Prix8 * File             : src/app/a-vendre/[uid]/page.tsx9 * Module           : app10 * Repository       : https://git.spboucher.ai/vrai-prix11 * Created          : 2026-09-0812 * Last Modified    : 2026-09-0813 *14 * Author           : Simon-Pierre Boucher15 * Position         : Professor of Finance16 * Institution      : Université du Québec en Outaouais (UQO)17 * Organization     : SP Boucher18 * Website          : https://spboucher.ai19 * Git              : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development      : dev@spboucher.ai23 * Support          : support@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// /a-vendre/{uid} : fiche d'une inscription à vendre, comparée à la valeur estimée de l'unité43// du rôle qui lui est jumelée.44import type { Metadata } from "next";45import { cache } from "react";46import { notFound } from "next/navigation";47import { FicheAnnonce } from "@/components/avendre/FicheAnnonce";48import { titreAnnonce } from "@/components/avendre/annonce";49import { chargerAnnonce } from "@/lib/annonce-fiche";50import { fmtFourchette, fmtPrix } from "@/lib/format";5152export const dynamic = "force-dynamic";5354const charger = cache((uid: string) => chargerAnnonce(uid));5556export async function generateMetadata({ params }: { params: Promise<{ uid: string }> }): Promise<Metadata> {57  const { uid } = await params;58  const d = charger(decodeURIComponent(uid));59  if (!d) return { title: "Inscription introuvable", robots: { index: false } };60  const l = d.det.listing;61  const e = d.det.eval;62  const ou = [titreAnnonce({ address: l.address, group: d.det.group, city: l.city }), l.address ? l.city : null].filter(Boolean).join(", ");63  const title = `${ou} : prix demandé ${fmtPrix(l.price)}${e?.est ? `, valeur estimée ${fmtPrix(e.est)}` : ""}`;64  const description = e?.est65    ? `Inscription à vendre : prix demandé ${fmtPrix(l.price)}, valeur estimée ${fmtPrix(e.est)} (fourchette ${fmtFourchette(e.low, e.high)}). Écart, fiabilité, ventes comparables et historique du prix.`66    : `Inscription à vendre : prix demandé ${fmtPrix(l.price)}. Photographies, caractéristiques et historique du prix.`;67  return {68    title,69    description,70    alternates: { canonical: `/a-vendre/${encodeURIComponent(l.uid)}` },71    openGraph: { title, description, type: "website" },72    // inscriptions éphémères, contenu de tiers73    robots: { index: false, follow: true },74  };75}7677export default async function AnnoncePage({ params }: { params: Promise<{ uid: string }> }) {78  const { uid } = await params;79  const data = charger(decodeURIComponent(uid));80  if (!data) notFound();81  return <FicheAnnonce data={data} />;82}83
Files main
Menu

Theme